package book;

public class Book {
   private String name; //书名
   private String author; //作者
   private double price; //价格
   private String type; //类型
   private boolean flg; //是否被借出，默认是false

    @Override
    public String toString() { //重写toString方法，快捷键生成
        return "Book{" +
                "name='" + name + '\'' +
                ",  author='" + author + '\'' +
                ",  price=" + price +
                ",  type='" + type + '\'' +
                ((flg==false)?" 未借出":" 已借出")+
               // ", flg=" + flg +             屏蔽掉，自己进行修改
                '}';
    }

    public Book(String name, String author, double price, String type) { //生成构造方法
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
    }

    public String getName() { //生成对应的get和set
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean isFlg() {
        return flg;
    }

    public void setFlg(boolean flg) {
        this.flg = flg;
    }

}
